package controllers;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import model.CaseRoomInfo;
import model.Unit;
import model.User_list;
import model.V_remind_type_one;

import com.et.mvc.JsonView;

public class PortalRemindController extends ApplicationController {
	/**
	 * 返回所所属单位超期未处理物品提醒
	 */
	public JsonView getRemindTypeOne(int rows, int page) throws Exception {
		User_list ul = (User_list)session.getAttribute("sessionAccount");
		String company_id = ul.getUser_company();
		List<Object> tmpArgs = new ArrayList<Object>();
		Object[] args = tmpArgs.toArray();
		String sql = "SELECT * FROM V_remind_type_one S";// WHERE S.company_id='"+company_id+"'
		List<V_remind_type_one> v_remind_type_one=V_remind_type_one.findBySql(V_remind_type_one.class, sql);
		long total = v_remind_type_one.size(); // 查询所属单位全部保管室总数
		List<V_remind_type_one> v_remind_type_one2 = V_remind_type_one.findBySql(V_remind_type_one.class, sql, args, "remind_id", rows, (page - 1) * rows);

		// 构造JSON用的数据结构并返回JSON视图
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("total", total);
		result.put("rows", v_remind_type_one2);
		return new JsonView(result);
	}

	/*
	 * 根据caseRoomId获取一条记录
	 */
	public JsonView getCaseRoomInfo(int id) throws Exception {
		CaseRoomInfo caseRoomInfo = CaseRoomInfo.find(CaseRoomInfo.class, id);
		return new JsonView(caseRoomInfo);
	}

}
